#define _CRT_SECURE_NO_WARNINGS 1

#include<vector>
#include<iostream>
using namespace std;

class Solution
{
public:
    vector<vector<int>> generate(int numRows)
    {
        std::vector<vector<int>> vv(numRows);
        //vv.reserve(numRows);
        for (int i = 0; i < numRows; i++)
        {
            vv[i].resize(i + 1, 0);
        }
        for (int i = 0; i < vv.size(); i++)
        {
            vv[i][0] = 1;
            vv[i][i] = 1;
        }
        for (int i = 2; i < vv.size(); i++)
        {
            for (int j = 1; j < i; j++)
            {
                vv[i][j] = vv[i - 1][j - 1] + vv[i - 1][j];
            }
        }
        return vv;
    }
};

int main()
{
    Solution ss;
    vector<vector<int>> ret = ss.generate(5);
    for (int i = 0;i < ret.size();++i)
    {
        for (int j = 0; j < ret[i].size(); ++j)
        {
            cout << ret[i][j] << "   ";
        }
        cout << endl;
    }

    return 0;
}